package com.design.composite.draw;

public class CompositeDemo {
    public static void main(String[] args) {
        // 创建简单图形
        Shape circle = new Circle();
        Shape rectangle = new Rectangle();

        // 创建组合图形
        CompositeShape compositeShape = new CompositeShape();
        compositeShape.addShape(circle);
        compositeShape.addShape(rectangle);

        // 绘制图形
        System.out.println("Drawing Individual Shapes:");
        circle.draw();
        rectangle.draw();

        System.out.println("\nDrawing Composite Shape:");
        compositeShape.draw();

        // 移动图形
        System.out.println("\nMoving Individual Shapes:");
        circle.move(100, 50);
        rectangle.move(200, 100);

        System.out.println("\nMoving Composite Shape:");
        compositeShape.move(300, 150);
    }
}
